<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>操作DOM</title>
</head>
<body>

<div class="div">
    <h1>标题1</h1>
    <p id="p1">p1</p>
    <p class="p2">p2</p>
</div>


<script !src="">
    "use strict";
    let h1 = document.getElementsByTagName('h1')[0];
    let p1 = document.getElementById('p1');
    let div1 = document.getElementsByClassName("div")[0];
    console.log(p1);
    div1.insertBefore(p1,h1);

</script>
</body>
</html>